package reflection;

public class Test3 {
    static {
        System.out.println("main加载");
    }
    public static void main(String[] args) throws ClassNotFoundException {
        //主动加载子类父类
//        Son s=new Son();
//        Class.forName("reflection.Son");
        //子类直接调用父类的静态变量，不会加载子类
//        System.out.println(Son.a);
        //数组不引起类加载
//        Son[] s2=new Son[10];
        System.out.println(Son.c);
    }


}
class Father{
    static {
        System.out.println("父类被加载");
    }
    static int a=10;
}
class Son extends Father {
    static {
        System.out.println("子类被加载");
        b=30;
    }
    static int b=20;
    static final int c=10;
    final int g=0;
    
}
